# dict1 = {'A': 1, 'B': 2, 'C': 3, 'D': 4}
# dict2 = {'B': 20, 'D': 40, 'E': 50}
#
# key_list = []
#
# for key in dict2:
#     if key in dict1:
#         key_list.append(key)
#
# print(key_list)

# my_dict = {'A': 10, 'B': 5, 'C': 15, 'D': 20}
# max_val = 0
# max_val_key = None
# for key, val in my_dict.items():
#     if val > max_val:
#         max_val = val
#         max_val_key = key
# print(max_val, max_val_key)

# my_dict = {'A': 2, 'B': 3, 'C': 4, 'D': 5}

# for key, val in my_dict.items():
#     print(key, val)
# ret = 1
# for val in my_dict.values():
#     ret *= val
# print(ret)
# my_tj = {}
# my_list = [1, 2, 3, 2, 1, 3, 4, 5, 2, 1]
# for item in my_list:
#     if item in my_tj:
#         my_tj[item] += 1
#     else:
#         my_tj[item] = 1
# print(my_tj)

# dict1 = {'A': 1, 'B': 2, 'C': 3}
# dict2 = {'B': 10, 'D': 20, 'C': 30}
#
# target_dict = {}
# target_key_set = set()
# for key, value in dict1.items():
#     target_key_set.add(key)
# for key, value in dict2.items():
#     target_key_set.add(key)
# for key in target_key_set:
#     target_dict[key] = 0
#     if key in dict1:
#         target_dict[key] += dict1[key]
#     if key in dict2:
#         target_dict[key] += dict2[key]
# print(target_dict)